<template>
	<view class="">
		<u-navbar title="我的积分"></u-navbar>

		<view class="content">

			<view class="t-body" v-if="list && list.length > 0">
				<view class="t-jf-item t-flex-row-sb" v-for="(item, index) in list" wx:key="index">
					<view class="t-flex-col-s t-lt">
						<!-- {{ item.type }}/ -->
						<text>{{ item.title }}</text>
						<text  :class="[{ 't-hx-color': item.bizType==5, 't-p-color': item.bizType!=5 }]">{{ item.bizType!=5
							? ("+" + item.point) : ("-"+item.point) }}
						</text>
					</view>
					<view v-if="item.bizType == 4">
						<u-badge value="双倍"></u-badge>
					</view>
					<view class="t-rt">{{ $u.timeFormat(item.createTime, "yyyy-mm-dd") }}</view>
					<!-- hh:MM:ss -->
				</view>
				<!-- createTime: 1746520132000
day: 1
experience: 0
point: 10 -->
			</view>
			<u-loadmore :status="status"></u-loadmore>
			<view class="" style="height: 10rpx"> </view>
		</view>
	</view>
</template>

<script>
// pointRecordPage
import {
	pointRecordPage
} from '@/api/points.js';
export default {
	data() {
		return {
			bgColor: "#17ba7a",
			list: [],
			scoreList: [
				// 	{
				// 	type: '分享好友',
				// 	score: 100,
				// 	createAt: '2022-12-09'
				// },
				// {
				// 	type: '兑换商品',
				// 	score: -5000,
				// 	createAt: '2022-11-08'
				// },
				// {
				// 	type: '分享好友',
				// 	score: 100,
				// 	createAt: '2022-10-09'
				// },
				// {
				// 	type: '浏览课程',
				// 	score: 1000,
				// 	createAt: '2022-09-19'
				// },
				// {
				// 	type: '分享好友',
				// 	score: 100,
				// 	createAt: '2022-09-09'
				// },
			]
		}
	},
	onLoad() {

	},
	computed: {
		reqdata() {
			let r = {};
			r.pageSize = 10;
			r.pageNo = Math.ceil(this.list.length / r.pageSize) + 1;

			return r;
		},
	},
	onReachBottom() {
		this.getData();
	},
	mounted() {
		this.init();
	},
	methods: {
		async init() {
			this.list = [];
			this.getData();
		
		},
		async getData() {
			this.status = "loading";
			uni.showLoading();
			let data = await pointRecordPage(this.reqdata);
			this.list = this.list.concat(data.data.list);
			uni.hideLoading();
			this.status =
				data.data.list.length >= this.reqdata.pageSize ? "more" : "noMore";
		},

	}
}
</script>

<style scoped lang="scss">
.t-flex-row {
	display: flex;
	flex-direction: row;
	justify-content: center;
	align-items: center;
}

.t-more {
	font-size: 28rpx;
	color: #888888;
	line-height: 40rpx;
	margin-top: 50rpx;
	margin-bottom: 85rpx;
}

.t-flex-row-sb {
	display: flex;
	flex-direction: row;
	justify-content: space-between;
	align-items: center;
}

.t-flex-col-s {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	align-items: center;
	flex: 1;
}

.content {
	background: #F6F3F3;
	min-width: 100vw;
	min-height: 100vh;
	box-sizing: border-box;
	padding-bottom: 30rpx;

	.t-body {
		width: 100%;
		padding: 0rpx 50rpx;
		background: #fff;
		box-sizing: border-box;
		border-top: 1rpx solid #D8D8D8;
	}

	.t-jf-item {
		width: 100%;
		height: 184rpx;
		box-sizing: border-box;
		padding: 40rpx 0rpx;
	}

	.t-jf-item:not(:last-child) {
		border-bottom: 1rpx solid #ddd;
	}

	.t-lt {
		align-items: flex-start;
		font-size: 30rpx;
		color: #333333;
		line-height: 42rpx;
	}

	.t-lt text:last-child {
		margin-top: 20rpx;
	}

	.t-rt {
		font-size: 30rpx;
		color: #333333;
		padding-left: 10rpx;
	}

	.t-hx-color {
		color: #D41428 !important;
	}

	.t-p-color {
		color: #39C03E !important;
	}

	.t-tips {
		margin-top: 50rpx;
		margin-bottom: 10rpx;
		font-size: 28rpx;
		color: #888888;
		line-height: 40rpx;
	}
}
</style>